package com.job.model;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

@Entity
@Table(name = "product")
public class Product implements Serializable {
	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	private Integer id;// 商品编号,自动增长
	@Column(length = 50)
	private String name;// 商品名称
	@Column(precision = 8, scale = 2)
	private BigDecimal price;// 商品价格
	@Column(length = 300)
	private String pic;// 商品图片
	@Lob
	private String remark;// 商品简单介绍
	@Lob
	private String xremark;// 商品详细介绍
	@Temporal(TemporalType.TIMESTAMP)
	@Column(columnDefinition = "timestamp default CURRENT_TIMESTAMP")
	private Date date = new Date();// 商品生产日期
	private Boolean commend;// 是否为推荐商品,推荐商品才有可能显示在商城首页
	private Boolean open;// 是否为有效商品,有效商品才有可能显示在商城首页
	@ManyToOne
	@JoinColumn(name = "cid")
	private Category category;
	
	public Product() {
		super();
	}

	public Product(Integer id, String name, BigDecimal price, String pic, String remark, String xremark, Date date,
			boolean commend, boolean open) {
		super();
		this.id = id;
		this.name = name;
		this.price = price;
		this.pic = pic;
		this.remark = remark;
		this.xremark = xremark;
		this.date = date;
		this.commend = commend;
		this.open = open;
	}

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public BigDecimal getPrice() {
		return price;
	}

	public void setPrice(BigDecimal price) {
		this.price = price;
	}

	public String getPic() {
		return pic;
	}

	public void setPic(String pic) {
		this.pic = pic;
	}

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	public String getXremark() {
		return xremark;
	}

	public void setXremark(String xremark) {
		this.xremark = xremark;
	}

	public Date getDate() {
		return date;
	}

	public void setDate(Date date) {
		this.date = date;
	}

	public Boolean getCommend() {
		return commend;
	}

	public void setCommend(Boolean commend) {
		this.commend = commend;
	}

	public Boolean getOpen() {
		return open;
	}

	public void setOpen(Boolean open) {
		this.open = open;
	}

	public Category getCategory() {
		return category;
	}

	public void setCategory(Category category) {
		this.category = category;
	}

}
